{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "4d23f326",
   "metadata": {},
   "source": [
    "## 2022/8/23\n",
    "## python课堂笔记"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "53e6909e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello world!\n"
     ]
    }
   ],
   "source": [
    "print(\"hello world!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "a82d6929",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello world!\n"
     ]
    }
   ],
   "source": [
    "print('hello world!')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ac14d0c9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "heelo world!\n"
     ]
    }
   ],
   "source": [
    "print(\"\"\"heelo world!\"\"\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "da704f2a",
   "metadata": {},
   "source": [
    "#### import:导入你需要的模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6a785c5a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# sys模块是一个用来处理python运行时环境的模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "3493c058",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "75d585e5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'win32'"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看Mac OS X内核名\n",
    "sys.platform"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ecec6d32",
   "metadata": {},
   "outputs": [],
   "source": [
    "# os 操作系统模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "cb2eb3f7",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "9c712668",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'D:\\\\gznfxy2022-2023-1-li\\\\python\\\\week01'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 代码所在文件夹\n",
    "os.getcwd()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ede9a87f",
   "metadata": {},
   "outputs": [],
   "source": [
    "# datetime 时间模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "afbfc950",
   "metadata": {},
   "outputs": [],
   "source": [
    "import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "a70a2086",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.date(2022, 9, 17)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看今天的日期\n",
    "datetime.date.today()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "d6b218a7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "17"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看日期\n",
    "datetime.date.today().day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "6d7104e9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "9"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看月份\n",
    "datetime.date.today().month"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "1d87e79a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2022"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看年份\n",
    "datetime.date.today().year"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "3796d10e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2022-10-15'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "datetime.date.isoformat(datetime.date.today())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "94759650",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "d5a6ebc5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'18:43'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看时间\n",
    "time.strftime(\"%H:%M\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "e06ae370",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Saturday PM'"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 看看星期几，是上午还是下午\n",
    "time.strftime(\"%A %p\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "acf0f745",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'This HTML fragment contains a &lt;script&gt;script&lt;/script&gt; tag.'"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 把一些编码的HTML恢复成原来的形式\n",
    "import html\n",
    "html.escape(\"This HTML fragment contains a <script>script</script> tag.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "3c0dce7d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"I ♥ Python's <standard library>.\""
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "html.unescape(\"I &hearts; Python's &lt;standard library&gt;.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cbf7ea22",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
